<template>
	<view class="filingDetails hwq-content">
		<!-- 事件归档---事件归档详情 -->
		<navBar :title="data.bizProjectName||''" :title2="(data.sectionName||'')+'、'+(data.siteName||'')"></navBar>

		<scroll-view scroll-y="true" class="hwq-scroll-box">
			<view class="content">
				<view class="box">
					<view class="nav">
						<view class="nav-item" @click="equipmentList">
							<image class="img" src="/subpackage-emergency/static/device.png" mode=""></image>
							<view>设备调用</view>
						</view>
						<view class="nav-item" @click="materialList">
							<image class="img" src="/subpackage-emergency/static/material.png" mode=""></image>
							<view>材料调用</view>
						</view>
						<view class="nav-item" @click="temporaryList">
							<image class="img" src="/subpackage-emergency/static/temp.png" mode=""></image>
							<view>临时采购</view>
						</view>
						<view class="nav-item" @click="rescuePersonnel">
							<image class="img" src="/subpackage-emergency/static/user.png" mode=""></image>
							<view>抢险人员</view>
						</view>
					</view>

					<view class="strip">
						<view class="strip-item">
							<view class="name"> 发生时间 </view>
							<view class="value">
								<view class="none"></view>
								<view class="text">{{ data.startTime2 || "" }}</view>
							</view>
						</view>
						<view class="strip-item">
							<view class="name"> 劳务人员 </view>
							<view class="value">
								<view class="none"></view>
								<view class="text">{{ data.laborNum || 0 }}人</view>
							</view>
						</view>
						<view class="strip-item" @click="disposalRecords">
							<view class="name"> 处置记录 </view>
							<view class="value">
								<view class="none"></view>
								<view class="text"></view>
								<u-icon name="arrow-right" size="22" color="#A7AEBD"></u-icon>
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>

		<view class="fixedButton" v-if="isFooter">
			<u-button type="primary" text="事件归档" :loading="loading" @click="toPigeonhole"></u-button>
		</view>
	</view>
</template>

<script>
	import {
	 getEventSummaryGet
	} from "@/api/emergency/emergencyDispatch.js"
	export default {
		name: "filingDetails",
		data() {
			return {
				loading: false,
				isFooter: true,
				data: {}
			}
		},
		onLoad(option) {
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('setData', (data) => {
				console.log("setDatasetDatasetData", data.data)
				this.data = data.data
				this.getEventSummaryGet(this.data.id)
			})
		},
		methods: {
			// 查看是否归档
			async getEventSummaryGet(id){
				let _query={
					currPage: 1,
					pageSize: 15,
					params: {
						eventId: id
					}
				}
				let res = await getEventSummaryGet(_query)
				if(res.result.list.length > 0){
					this.isFooter = false
				}else{
					this.isFooter = true
				}
			},
			
			//设备调用
			equipmentList() {
				uni.navigateTo({
					url: `/pages/commandDecision/equipmentList?id=`+this.data.id,
				})
			},
			
			//材料调用
			materialList() {
				uni.navigateTo({
					url: `/pages/commandDecision/materialList?id=`+this.data.id,
				})
			},
			//临时调用
			temporaryList() {
				uni.navigateTo({
					url: `/pages/commandDecision/temporaryList?id=`+this.data.id,
				})
			},
			//处置记录
			disposalRecords(){
				uni.navigateTo({
					url: `/pages/commandDecision/disposalRecords?id=`+this.data.id,
				})
			},
			// 抢险人员
			rescuePersonnel(){
				uni.navigateTo({
					url: `/pages/commandDecision/rescuePersonnel?id=`+this.data.id,
				})
			},
			
			// 跳转到事件归档
			toPigeonhole(){
				if(this.loading) return
				this.loading = true
				console.log(this.data,'datadata')
				// uni.navigateTo({
				// 	url: `/pages/eventArchiving/pigeonhole?id=${this.data.id}&projectCascade=${this.data.projectCascade}`,
				// })
				uni.navigateTo({
					url: `/pages/eventArchiving/pigeonhole`,
					success:(res)=>{
						res.eventChannel.emit("setData",{
							data: this.data
						})
					}
				})
				
				this.loading = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.filingDetails {
		.content {
			padding-top: 30rpx;
			background-color: #F5F7FA;

			.box {
				background-color: #FFFFFF;
				padding: 0rpx 30rpx;
			}

			.nav {
				display: flex;
				font-size: 22rpx;
				font-weight: 500;
				color: #445469;
				padding-top: 42rpx;
				margin-bottom: 42rpx;

				.nav-item {
					flex: 1;
					text-align: center;
				}

				.img {
					width: 80rpx;
					height: 80rpx;
				}
			}

			.strip {
				.strip-item {
					height: 100rpx;
					line-height: 100rpx;
					padding: 0rpx 30rpx;
					font-weight: 500;
					color: #445469;
					display: flex;
					border-bottom: 1rpx solid #e1e5ed;

					.name {
						font-weight: bold;
					}

					.value {
						flex: 1;
						display: flex;
						align-items: center;

						.none {
							flex: 1;
						}

						.text {
							margin-right: 20rpx;
						}
					}
				}
			}
		}
	}
</style>
<style scoped>
	.hwq-content {
		padding: 0;
	}
</style>
